﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using PlugNT.Custom;
using PlugNT.Cms.Core;
using PlugNT.Cms.BLL;
using PlugNT.Cms.Model;
using PlugNT.Cms.Page;

namespace PlugNT.Cms.Web.Admin.Pre_Article
{
    public partial class InterfaceAutoUpdate : System.Web.UI.Page     //AdminPage
    {

        //需要设置可自动更新的页面
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (h_adminpassword.Value.Trim() == WebConfig.AdminInterfaceKey)
                {
                    if (h_update.Value.Trim().ToLower() == "true")
                    {
                        Response.Write("autoupdate-ok");
                        Response.Flush();

                        if (Sys.Info.articleupdated)
                        {
                            Sys.Info.articleupdated = false;
                            Sys.UpdateArticleupdated();
                            PageBuilder.UpdatePages();
                        }
                    }
                    else
                    {
                        Response.Write("autoupdate-error-adminpassword 错误！");
                    }
                }
                else
                {
                    Response.Write("autoupdate-error-adminpassword 错误！");
                }

            }
            catch (Exception ex)
            {
                Response.Write("autoupdate-error-errorstring:" + ex.StackTrace);
            }
        }

    }
}


